import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortById implements SortPredicate{

    Comparator<Employee> comparator = new Comparator<Employee>() {
        @Override
        public int compare(Employee o1, Employee o2) {
            return o1.getId().compareTo(o2.getId());
        }
    };

    @Override
    public List<Employee> sort(List<Employee> list, Boolean asc) {
        list.sort(comparator);
        if (!asc) {
            Collections.reverse(list);
        }
        return list;
    }
}
